import axios from '@/utils/request'

/**
 * 对文章不感兴趣接口
 * @param {*} id 文章的id
 * @returns
 */
export function disLikeArticle (id) {
  return axios({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target: id
    }
  })
}

/**
 * 举报文章接口
 * @param {*} id 文章的接口
 * @param {*} value
 * @returns
 */
export function reportArticle (id, value) {
  return axios({
    method: 'post',
    url: '/v1_0/article/reports',
    data: {
      target: id,
      type: value
    }
  })
}

/**
 * 获取文章详情
 * @param {*} id 文章的id
 * @returns
 */
export function getArticleDetail (id) {
  return axios({
    method: 'get',
    url: '/v1_0/articles/' + id
  })
}

/**
 * 给文章点赞
 * @param {*} id 文章id
 * @returns
 */
export function goArticleZan (id) {
  return axios({
    method: 'post',
    url: '/v1_0/article/likings',
    data: {
      target: id
    }
  })
}

/**
 * 取消文章点赞
 * @param {*} id 文章id
 * @returns
 */
export function escZan (id) {
  return axios({
    method: 'DELETE',
    url: '/v1_0/article/likings/' + id
  })
}

/**
 * 不喜欢文章的接口
 * @param {*} id 文章id
 * @returns
 */
export function addDislike (id) {
  return axios({
    method: 'post',
    url: '/v1_0/article/dislikes',
    data: {
      target: id
    }
  })
}

/**
 * 取消对文章的不喜欢
 * @param {*} id 文章id
 * @returns
 */
export function unDislike (id) {
  return axios({
    method: 'DELETE',
    url: '/v1_0/article/dislikes/' + id
  })
}
